
import 'package:mybaseplus/base/tool/api/IAppEnv.dart';
import 'package:mybaseplus/base/tool/language/FFMultiLanguage.dart';
import 'package:mybaseplus/base/tool/platformUtils/FFPlatform.dart';
import 'package:mybaseplus_example/bloc/userbloc/user_bloc.dart';

class ConfigApi implements IAppEnv {
  @override
  String env_local = "";

  @override
  String env_product = "";

  @override
  bool isProduct = false;

  @override
  bool isShowTestBtn = false;

  @override
  bool printApiData = true;

  @override
  Map<String, dynamic>? setHeader(Map<String, dynamic>? headers) {
    if (UserBlocTool.isLogin()) {
      if (headers == null) {
        headers = {"token": UserBlocTool.token()};
      } else {
        headers["token"] = UserBlocTool.token();
      }
    }
    //设置语言
    headers!["lang"] = FFMultiLanguage.getLang();
    headers["platform"] = FFPlatform.isIOS ? "ios" : "android";
    return headers;
  }
}
